#include "Shape.h"

class ENGINE_API Triangle : public Shape
{
public:
	Triangle() : Shape() 
	{
		primitiveType = DrawPrimitives::TRIANGLE_LIST;
		vertexs = new COL_VERTEX[3];
		if(vertexs == NULL) throw std::bad_alloc();

		vertexCount = 3;
		setColor(0x000000);
	}

	void resetVertexs()
	{
		vertexs[0].x = posX;
		vertexs[0].y = posY;
		vertexs[0].z = 0;
		vertexs[0].rhw = 1.0f;

		vertexs[1].x = posX + Width;
		vertexs[1].y = posY + Height;
		vertexs[1].z = 0;
		vertexs[1].rhw = 1.0f;

		vertexs[2].x = posX;
		vertexs[2].y = posY + Height;
		vertexs[2].z = 0;
		vertexs[2].rhw = 1.0f;
	}

	~Triangle() { delete[] vertexs; }
};